import Foundation

internal class NbDnvbpESqnqDInl {
    private init() {}
    
    static var HNMTEjFdjzjxYWYx: YIMOption?
    static var ZOjIzOztbVARDuqG:String?
    static var ZPyrCbzOlbdctqkw:YIMUser?
    static var rbtEkWTTnlkPCykk:[String]?
    static var CrqtQKnPpOIPqGjt:[String]?
    static var vBnlRsjXyYsjAiyP:[String]?
    static let hUaxJkdEfQCZrrHT = qkQorSShcjrKyhkX()
    static let bgaUTCffvgrJbXZU = yJcxbXpHZtnPzHSt()
    static let vCnvSnhevITORrOX = PuwHWgrMwiOuoSTf()
    static let KxuJgneUsZVEQtvM = WGthmeUfEWrRecLn()
    static let ZSgCfzHnxpKhZfxO = sYYOQcJgzfspJCWn()
    static let zYOvKsmnWpOUpLXr = QhRdOrIHpflpNVmj()
    static let SoORWivnNfUskmhc = bSLbZBOdkJvGpIri()
}

open class YIMResult<T> {
    init(VnJfdRrzZmdnJmsc:T, EmqetgaKELbCTYMP:String) {
        self.code = VnJfdRrzZmdnJmsc
        self.msg = EmqetgaKELbCTYMP
    }
    
    public let code:T!
    public let msg:String!
}

open class YIMOption: NSObject {
    public init(
        appKey:String,
        server_im: String? = nil,
        server_push: String? = nil,
        debugKey: String? = nil
    ) {
        self.appKey = appKey
        self.server_im = server_im
        self.server_push = server_push
        self.debugKey = debugKey
    }
    
    let appKey:String!
    let server_im:String?
    let server_push:String?
    let debugKey:String?
}

@objc open class YIMMessage: NSObject, Codable {
    public var id: String = ""
    public var content: String?
    public var from: String = ""
    public var fromInfo: YIMInfo?
    public var to: String = ""
    public var toInfo: YIMInfo?
    public var conversationType: YIMEnum_ConversationType! = .UnKnown
    public var messageType: YIMEnum_MessageType! = .UnKnown
    public var messageState: YIMEnum_MessageState! = .UnKnown
    public var time: Int = 0
    public var localExt: NSMutableDictionary?
    public var isRevoke: Bool = false
    public var attachment: YIMAttachment?
    
    internal override init() {
        super.init()
    }
    
    internal init(GZRevkeIIdHLwXxe: _YIMTable_Message) {
        self.id = GZRevkeIIdHLwXxe.id
        self.content = GZRevkeIIdHLwXxe.content
        self.from = GZRevkeIIdHLwXxe.from
        self.fromInfo = GZRevkeIIdHLwXxe.fromInfo
        self.to = GZRevkeIIdHLwXxe.to
        self.toInfo = GZRevkeIIdHLwXxe.toInfo
        self.conversationType = YIMEnum_ConversationType(rawValue: GZRevkeIIdHLwXxe.conversationType)!
        self.messageType = YIMEnum_MessageType(rawValue: GZRevkeIIdHLwXxe.messageType)!
        self.messageState = YIMEnum_MessageState(rawValue: GZRevkeIIdHLwXxe.messageState)!
        self.time = GZRevkeIIdHLwXxe.time
        self.localExt = NbDnvbpESqnqDInl.zYOvKsmnWpOUpLXr.GkNTaCvzlvcowaSg(GZRevkeIIdHLwXxe.localExt)
        self.isRevoke = GZRevkeIIdHLwXxe.isRevoke == "1"
        self.attachment = GZRevkeIIdHLwXxe.attachment == nil ? nil : NbDnvbpESqnqDInl.zYOvKsmnWpOUpLXr.IYMCIgmwfHIBQjIX(GZRevkeIIdHLwXxe.attachment, YIMAttachment.self)
    }
    
    private enum CodingKeys: String, CodingKey {
        case id
        case content
        case from
        case fromInfo
        case to
        case toInfo
        case conversationType
        case messageType
        case messageState
        case time
        case localExt
        case isRevoke
        case attachment
    }
    
    public func encode(to EMNYQVvqNJiIgaqk: any Encoder) throws {
        var SrUGOTAxXIcdNHHF = EMNYQVvqNJiIgaqk.container(keyedBy: CodingKeys.self)
        try SrUGOTAxXIcdNHHF.encode(id, forKey: .id)
        try SrUGOTAxXIcdNHHF.encode(content, forKey: .content)
        try SrUGOTAxXIcdNHHF.encode(from, forKey: .from)
        try SrUGOTAxXIcdNHHF.encode(fromInfo, forKey: .fromInfo)
        try SrUGOTAxXIcdNHHF.encode(to, forKey: .to)
        try SrUGOTAxXIcdNHHF.encode(toInfo, forKey: .toInfo)
        try SrUGOTAxXIcdNHHF.encode(conversationType, forKey: .conversationType)
        try SrUGOTAxXIcdNHHF.encode(messageType, forKey: .messageType)
        try SrUGOTAxXIcdNHHF.encode(messageState, forKey: .messageState)
        try SrUGOTAxXIcdNHHF.encode(time, forKey: .time)
        try SrUGOTAxXIcdNHHF.encode(localExt == nil ? nil : NbDnvbpESqnqDInl.zYOvKsmnWpOUpLXr.xtovshfHwqTsyirV(localExt!), forKey: .localExt)
        try SrUGOTAxXIcdNHHF.encode(isRevoke ? "1" : "0", forKey: .isRevoke)
        try SrUGOTAxXIcdNHHF.encode(attachment, forKey: .attachment)
    }
    
    required public init(from sfUPMcOtmkluyPKK: any Decoder) throws {
        super.init()
        let SrUGOTAxXIcdNHHF = try sfUPMcOtmkluyPKK.container(keyedBy: CodingKeys.self)
        id = try SrUGOTAxXIcdNHHF.decode(String.self, forKey: .id)
        if let umLPpQHNmFlDeYyH = try SrUGOTAxXIcdNHHF.decodeIfPresent(String.self, forKey: .content) {
            content = umLPpQHNmFlDeYyH
        }
        from = try SrUGOTAxXIcdNHHF.decode(String.self, forKey: .from)
        if let YkJaaNUSklqAodtF = try SrUGOTAxXIcdNHHF.decodeIfPresent(YIMInfo.self, forKey: .fromInfo) {
            fromInfo = YkJaaNUSklqAodtF
        }
        to = try SrUGOTAxXIcdNHHF.decode(String.self, forKey: .to)
        if let ddtFGqBbtUUqSrrq = try SrUGOTAxXIcdNHHF.decodeIfPresent(YIMInfo.self, forKey: .toInfo) {
            toInfo = ddtFGqBbtUUqSrrq
        }
        conversationType = try SrUGOTAxXIcdNHHF.decode(YIMEnum_ConversationType.self, forKey: .conversationType)
        messageType = try SrUGOTAxXIcdNHHF.decode(YIMEnum_MessageType.self, forKey: .messageType)
        messageState = try SrUGOTAxXIcdNHHF.decode(YIMEnum_MessageState.self, forKey: .messageState)
        time = try SrUGOTAxXIcdNHHF.decode(Int.self, forKey: .time)
        if let LOMPQKzpsgGrXaib = try SrUGOTAxXIcdNHHF.decode(String?.self, forKey: .localExt) {
            localExt = NbDnvbpESqnqDInl.zYOvKsmnWpOUpLXr.GkNTaCvzlvcowaSg(LOMPQKzpsgGrXaib)
        }
        isRevoke = try SrUGOTAxXIcdNHHF.decode(String.self, forKey: .isRevoke) == "1"
        if let JysBCFnGQzbcFFoA = try SrUGOTAxXIcdNHHF.decodeIfPresent(YIMAttachment.self, forKey: .attachment) {
            attachment = JysBCFnGQzbcFFoA
        }
    }
    
    public func getConversationID() -> String {
        switch (conversationType!) {
        case YIMEnum_ConversationType.P2P:
            return getIsMine() ? to : from
        case YIMEnum_ConversationType.Team:
            return to
        case YIMEnum_ConversationType.ChatRoom:
            return to
        default: return ""
        }
    }
    
    public func getIsMine() -> Bool {
        return from == NbDnvbpESqnqDInl.ZOjIzOztbVARDuqG
    }
    
    public func getConversationInfo() -> YIMInfo? {
        switch (conversationType!) {
        case YIMEnum_ConversationType.P2P:
            return getIsMine() ? toInfo : fromInfo
        case YIMEnum_ConversationType.Team:
            return toInfo
        case YIMEnum_ConversationType.ChatRoom:
            return toInfo
        default: return nil
        }
    }
}

open class YIMConversation: NSObject, Codable {
    public var lastMessage: YIMMessage!
    public var unRead: Int = 0
    public var isTop: Bool = false
    public var isDisturb: Bool = false
    
    internal override init() {
        super.init()
    }
    
    init(xMeiNXsxexQoqySe: _YIMTable_Conversation) {
        super.init()
        self.lastMessage = YIMMessage(GZRevkeIIdHLwXxe: xMeiNXsxexQoqySe.lastMessage)
        self.unRead = xMeiNXsxexQoqySe.unRead
        self.isTop = xMeiNXsxexQoqySe.isTop
        self.isDisturb = xMeiNXsxexQoqySe.isDisturb
    }
    
    public func getConversationID() -> String {
        return self.lastMessage.getConversationID()
    }
    
    public func getIsMine() -> Bool {
        return self.lastMessage.getIsMine()
    }
    
    public func getConversationInfo() -> YIMInfo? {
        return self.lastMessage.getConversationInfo()
    }
}

open class YIMBroadcastMessage: NSObject, Codable {
    public var id:String! = ""
    public var from:String! = ""
    public var content:String! = ""
    public var time:TimeInterval! = 0
    
    internal override init() {
        super.init()
    }
}

open class YIMNotificationMessage: NSObject, Codable {
    public var id:String! = ""
    public var from:String! = ""
    public var content:String! = ""
    public var time:TimeInterval! = 0
    
    internal override init() {
        super.init()
    }
}

open class YIMRevokeMessage: NSObject, Codable {
    public var messageID:String! = ""
    public var conversationID:String! = ""
    public var conversationType: YIMEnum_ConversationType! = .UnKnown
    
    internal override init() {
        super.init()
    }
}

open class YIMInfo: NSObject, Codable {
    public var id: String! = ""
    public var name: String! = ""
    public var icon: String! = ""
    public var ext: String! = ""
    
    internal override init() {
        super.init()
    }
    
    private enum CodingKeys: String, CodingKey {
        case id
        case name
        case icon
        case ext
    }
    
    public func encode(to EMNYQVvqNJiIgaqk: any Encoder) throws {
        var SrUGOTAxXIcdNHHF = EMNYQVvqNJiIgaqk.container(keyedBy: CodingKeys.self)
        try SrUGOTAxXIcdNHHF.encode(id, forKey: .id)
        try SrUGOTAxXIcdNHHF.encode(name, forKey: .name)
        try SrUGOTAxXIcdNHHF.encode(icon, forKey: .icon)
        try SrUGOTAxXIcdNHHF.encode(ext, forKey: .ext)
    }
    
    required public init(from sfUPMcOtmkluyPKK: any Decoder) throws {
        super.init()
        let SrUGOTAxXIcdNHHF = try sfUPMcOtmkluyPKK.container(keyedBy: CodingKeys.self)
        id = try SrUGOTAxXIcdNHHF.decode(String.self, forKey: .id)
        if let pnVoLYzJBOjUrpAF = try SrUGOTAxXIcdNHHF.decodeIfPresent(String.self, forKey: .name) {
            name = pnVoLYzJBOjUrpAF
        }
        if let FfcsIuFaCsmQWcjK = try SrUGOTAxXIcdNHHF.decodeIfPresent(String.self, forKey: .icon) {
            icon = FfcsIuFaCsmQWcjK
        }
        if let UpAsLurPhzsCwFjq = try SrUGOTAxXIcdNHHF.decodeIfPresent(String.self, forKey: .ext) {
            ext = UpAsLurPhzsCwFjq
        }
    }
}

open class YIMUser: YIMInfo {
}

open class YIMTeam: YIMInfo {
}

open class YIMRoom: YIMInfo {
}

open class YIMAttachment: NSObject, Codable {
    public var type: YIMEnum_AttachmentType = .UnKnown
    public var url: String = ""
    public var size: Int = 0
    public var format: String = ""
    public var ext: _YIMAttachmentExt?
    
    internal override init() {
        super.init()
    }
    
    private enum CodingKeys: String, CodingKey {
        case type
        case url
        case size
        case format
        case ext
    }
    
    public func encode(to EMNYQVvqNJiIgaqk: any Encoder) throws {
        var SrUGOTAxXIcdNHHF = EMNYQVvqNJiIgaqk.container(keyedBy: CodingKeys.self)
        try SrUGOTAxXIcdNHHF.encode(type, forKey: .type)
        try SrUGOTAxXIcdNHHF.encode(url, forKey: .url)
        try SrUGOTAxXIcdNHHF.encode(size, forKey: .size)
        try SrUGOTAxXIcdNHHF.encode(format, forKey: .format)
        try SrUGOTAxXIcdNHHF.encode(ext, forKey: .ext)
    }
    
    required public init(from sfUPMcOtmkluyPKK: any Decoder) throws {
        super.init()
        let SrUGOTAxXIcdNHHF = try sfUPMcOtmkluyPKK.container(keyedBy: CodingKeys.self)
        type = try SrUGOTAxXIcdNHHF.decode(YIMEnum_AttachmentType.self, forKey: .type)
        url = try SrUGOTAxXIcdNHHF.decode(String.self, forKey: .url)
        size = try SrUGOTAxXIcdNHHF.decode(Int.self, forKey: .size)
        format = try SrUGOTAxXIcdNHHF.decode(String.self, forKey: .format)
        switch type {
        case .Audio:
            ext = try SrUGOTAxXIcdNHHF.decode(YIMAttachmentExt_Audio.self, forKey: .ext)
        case .Image:
            ext = try SrUGOTAxXIcdNHHF.decode(YIMAttachmentExt_Image.self, forKey: .ext)
        case .Video:
            ext = try SrUGOTAxXIcdNHHF.decode(YIMAttachmentExt_Video.self, forKey: .ext)
        case .File:
            ext = try SrUGOTAxXIcdNHHF.decode(YIMAttachmentExt_File.self, forKey: .ext)
        default:
            ext = nil
        }
    }
}

open class _YIMAttachmentExt: NSObject, Codable {
    public var type: YIMEnum_AttachmentType = .UnKnown
}

class YIMAttachmentExt_Audio: _YIMAttachmentExt {
    public var duration: Int = 0
    
    required override init() {
        super.init()
        self.type = .Audio
    }
    
    private enum CodingKeys: String, CodingKey {
        case type
        case duration
    }
    
    override func encode(to EMNYQVvqNJiIgaqk: any Encoder) throws {
        var SrUGOTAxXIcdNHHF = EMNYQVvqNJiIgaqk.container(keyedBy: CodingKeys.self)
        try SrUGOTAxXIcdNHHF.encode(type, forKey: .type)
        try SrUGOTAxXIcdNHHF.encode(duration, forKey: .duration)
    }
    
    required public init(from sfUPMcOtmkluyPKK: any Decoder) throws {
        super.init()
        let SrUGOTAxXIcdNHHF = try sfUPMcOtmkluyPKK.container(keyedBy: CodingKeys.self)
        type = try SrUGOTAxXIcdNHHF.decode(YIMEnum_AttachmentType.self, forKey: .type)
        duration = try SrUGOTAxXIcdNHHF.decode(Int.self, forKey: .duration)
    }
}

class YIMAttachmentExt_Image: _YIMAttachmentExt {
    public var compress: Bool = false
    
    required override init() {
        super.init()
        self.type = .Image
    }
    
    private enum CodingKeys: String, CodingKey {
        case type
        case compress
    }
    
    override func encode(to EMNYQVvqNJiIgaqk: any Encoder) throws {
        var SrUGOTAxXIcdNHHF = EMNYQVvqNJiIgaqk.container(keyedBy: CodingKeys.self)
        try SrUGOTAxXIcdNHHF.encode(type, forKey: .type)
        try SrUGOTAxXIcdNHHF.encode(compress ? "1" : "0", forKey: .compress)
    }
    
    required public init(from sfUPMcOtmkluyPKK: any Decoder) throws {
        super.init()
        let SrUGOTAxXIcdNHHF = try sfUPMcOtmkluyPKK.container(keyedBy: CodingKeys.self)
        type = try SrUGOTAxXIcdNHHF.decode(YIMEnum_AttachmentType.self, forKey: .type)
        compress = try SrUGOTAxXIcdNHHF.decode(String.self, forKey: .compress) == "1"
    }
}

class YIMAttachmentExt_Video: _YIMAttachmentExt {
    public var duration: Int = 0
    public var image: String = ""
    public var compress: Bool = false
    
    required override init() {
        super.init()
        self.type = .Video
    }
    
    private enum CodingKeys: String, CodingKey {
        case type
        case duration
        case image
        case compress
    }
    
    override func encode(to EMNYQVvqNJiIgaqk: any Encoder) throws {
        var SrUGOTAxXIcdNHHF = EMNYQVvqNJiIgaqk.container(keyedBy: CodingKeys.self)
        try SrUGOTAxXIcdNHHF.encode(type, forKey: .type)
        try SrUGOTAxXIcdNHHF.encode(duration, forKey: .duration)
        try SrUGOTAxXIcdNHHF.encode(image, forKey: .image)
        try SrUGOTAxXIcdNHHF.encode(compress ? "1" : "0", forKey: .compress)
    }
    
    required public init(from sfUPMcOtmkluyPKK: any Decoder) throws {
        super.init()
        let SrUGOTAxXIcdNHHF = try sfUPMcOtmkluyPKK.container(keyedBy: CodingKeys.self)
        type = try SrUGOTAxXIcdNHHF.decode(YIMEnum_AttachmentType.self, forKey: .type)
        duration = try SrUGOTAxXIcdNHHF.decode(Int.self, forKey: .duration)
        image = try SrUGOTAxXIcdNHHF.decode(String.self, forKey: .image)
        compress = try SrUGOTAxXIcdNHHF.decode(String.self, forKey: .compress) == "1"
    }
}

class YIMAttachmentExt_File: _YIMAttachmentExt {
    public var name: String = ""
    
    required override init() {
        super.init()
        self.type = .Video
    }
    
    private enum CodingKeys: String, CodingKey {
        case type
        case name
    }
    
    override func encode(to EMNYQVvqNJiIgaqk: any Encoder) throws {
        var SrUGOTAxXIcdNHHF = EMNYQVvqNJiIgaqk.container(keyedBy: CodingKeys.self)
        try SrUGOTAxXIcdNHHF.encode(type, forKey: .type)
        try SrUGOTAxXIcdNHHF.encode(name, forKey: .name)
    }
    
    required init(from sfUPMcOtmkluyPKK: any Decoder) throws {
        super.init()
        let SrUGOTAxXIcdNHHF = try sfUPMcOtmkluyPKK.container(keyedBy: CodingKeys.self)
        type = try SrUGOTAxXIcdNHHF.decode(YIMEnum_AttachmentType.self, forKey: .type)
        name = try SrUGOTAxXIcdNHHF.decode(String.self, forKey: .name)
    }
}

open class YIMPushOption: NSObject, Codable {
    public var title: String?
    public var content: String?
    public var extras: NSMutableDictionary?
    public var configs: YIMPushOption_Config?
    
    public override init() {
        super.init()
    }
    
    private enum CodingKeys: String, CodingKey {
        case title
        case content
        case extras
        case configs
    }
    
    public func encode(to EMNYQVvqNJiIgaqk: any Encoder) throws {
        var SrUGOTAxXIcdNHHF = EMNYQVvqNJiIgaqk.container(keyedBy: CodingKeys.self)
        try SrUGOTAxXIcdNHHF.encode(title, forKey: .title)
        try SrUGOTAxXIcdNHHF.encode(content, forKey: .content)
        try SrUGOTAxXIcdNHHF.encode(extras == nil ? nil : NbDnvbpESqnqDInl.zYOvKsmnWpOUpLXr.xtovshfHwqTsyirV(extras!), forKey: .extras)
        try SrUGOTAxXIcdNHHF.encode(configs, forKey: .configs)
    }
    
    required public init(from sfUPMcOtmkluyPKK: any Decoder) throws {
    }
}

open class YIMPushOption_Config: NSObject, Codable {
    public var android: YIMPushOption_Config_Android?
    public var ios: YIMPushOption_Config_Ios?
    
    public override init() {
        super.init()
    }
    
    private enum CodingKeys: String, CodingKey {
        case android
        case ios
    }
    
    public func encode(to EMNYQVvqNJiIgaqk: any Encoder) throws {
        var SrUGOTAxXIcdNHHF = EMNYQVvqNJiIgaqk.container(keyedBy: CodingKeys.self)
        try SrUGOTAxXIcdNHHF.encode(android, forKey: .android)
        try SrUGOTAxXIcdNHHF.encode(ios, forKey: .ios)
    }
    
    required public init(from sfUPMcOtmkluyPKK: any Decoder) throws {
    }
}

open class YIMPushOption_Config_Android: NSObject, Codable {
    public var intent_uri: String?
    
    public override init() {
        super.init()
    }
    
    private enum CodingKeys: String, CodingKey {
        case intent_uri
    }
    
    public func encode(to EMNYQVvqNJiIgaqk: any Encoder) throws {
        var SrUGOTAxXIcdNHHF = EMNYQVvqNJiIgaqk.container(keyedBy: CodingKeys.self)
        try SrUGOTAxXIcdNHHF.encode(intent_uri, forKey: .intent_uri)
    }
    
    required public init(from sfUPMcOtmkluyPKK: any Decoder) throws {
    }
}

open class YIMPushOption_Config_Ios: NSObject, Codable {
    public var isSandbox: Bool?
    
    public override init() {
        super.init()
    }
    
    private enum CodingKeys: String, CodingKey {
        case isSandbox
    }
    
    public func encode(to EMNYQVvqNJiIgaqk: any Encoder) throws {
        var SrUGOTAxXIcdNHHF = EMNYQVvqNJiIgaqk.container(keyedBy: CodingKeys.self)
        try SrUGOTAxXIcdNHHF.encode(isSandbox, forKey: .isSandbox)
    }
    
    required public init(from sfUPMcOtmkluyPKK: any Decoder) throws {
    }
}
